-------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- Table Creation Through Script -------------------------------------------------------------------------------------------------------------------------------------------------------------------- if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TableRelationships]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[TableRelationships] GO CREATE TABLE [dbo].[TableRelationships] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [TableName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [PrimaryKey] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [ForeignTableName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [ForeignKey] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [ErrorMessage] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Counter] [bit] NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO ALTER TABLE [dbo].[TableRelationships] WITH NOCHECK ADD CONSTRAINT [PK_Object_Relationships] PRIMARY KEY CLUSTERED ( [ID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[TableRelationships] ADD CONSTRAINT [DF_Object_Relationships_Counter] DEFAULT (0) FOR [Counter] GO -------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- Inserting Table Data Through Script -------------------------------------------------------------------------------------------------------------------------------------------------------------------- INSERT INTO TableRelationships (TableName,PrimaryKey,ForeignTableName,ForeignKey,ErrorMessage) VALUES('SessionInfo','SessionID','StudentsInfo','SessionID','This Session Is Used In Students Information.') INSERT INTO TableRelationships (TableName,PrimaryKey,ForeignTableName,ForeignKey,ErrorMessage) VALUES ('SectionInfo','SectionID','StudentsInfo','SectionID','This Section Is Used In Students Information.') INSERT INTO TableRelationships (TableName,PrimaryKey,ForeignTableName,ForeignKey,ErrorMessage) VALUES ('CollegeInfo','CollegeID','StudentsInfo','CollegeID','This College Is Used In Students Information.') INSERT INTO TableRelationships (TableName,PrimaryKey,ForeignTableName,ForeignKey,ErrorMessage) VALUES ('CourseInfo','CourseID','StudentsInfo','CourseID','This Course Is Used In Students Information.') INSERT INTO TableRelationships (TableName,PrimaryKey,ForeignTableName,ForeignKey,ErrorMessage) VALUES ('SubjectInfo','SubjectID','CourseInfoDetail','SubjectID','This Subject Is Used In Course Information.') INSERT INTO TableRelationships (TableName,PrimaryKey,ForeignTableName,ForeignKey,ErrorMessage) VALUES ('StudentsInfo','StudentID','ReceiptInfo','StudentID','This Student Information Is Used In Fees Vouchers.') INSERT INTO TableRelationships (TableName,PrimaryKey,ForeignTableName,ForeignKey,ErrorMessage) VALUES ('StudentsInfo','StudentID','AttendanceDetail','StudentID','This Student Information Is Used In Attendance Vouchers.') INSERT INTO TableRelationships (TableName,PrimaryKey,ForeignTableName,ForeignKey,ErrorMessage) VALUES ('StudentsInfo','StudentID','ResultDetail','StudentID','This Student Information Is Used In Result Vouchers.') INSERT INTO TableRelationships (TableName,PrimaryKey,ForeignTableName,ForeignKey,ErrorMessage) VALUES ('ResultTypeInfo','ResultTypeID','ResultInfo','ResultTypeID','This Result Type Information Is Used In Result Vouchers.') --------------------------------------------------------------------------------------------------------------------------------------------------------------------